
Partial Class main
    Inherits System.Web.UI.MasterPage

    Protected Sub MediniMenu_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles MediniMenu.MenuItemClick
        Dim str As String = ""

        If e.Item.Value.ToLower = "newvoucher" Then
            Response.Redirect("default.aspx")
        ElseIf e.Item.Value.ToLower = "newreciept" Then
            Response.Redirect("default.aspx?mode=r")
        ElseIf e.Item.Value.ToLower = "logoff" Then
            FormsAuthentication.SignOut()
            Response.Redirect("default.aspx")
        Else
            Response.Redirect("reports.aspx")
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim item As MenuItem
        For Each item In MediniMenu.Items
            If (item.Value.ToLower().Equals("logoff")) Then
                If (System.Web.HttpContext.Current.User.Identity.IsAuthenticated) Then
                    item.Enabled = True
                Else
                    item.Enabled = False
                End If
            End If
        Next

        lblYear.Text = Session("year")
    End Sub
End Class

